package com.xplay.xpocker.room.message.service;

import com.xplay.xpocker.config.security.CurrentUser;
import com.xplay.xpocker.observer.ChannelHandlerManager;
import com.xplay.xpocker.room.message.MessageContent;
import com.xplay.xpocker.room.message.AbstractMessageStrategy;
import com.xplay.xpocker.room.message.MessageType;
import org.springframework.stereotype.Service;

@Service
public class ChatMessageService extends AbstractMessageStrategy {

    @Override
    public void doMessage(String code, MessageContent<Object> data) {
        data.setMessageFromUid(CurrentUser.getUserId());
        ChannelHandlerManager.getInstance().notifyMessage(data);
    }

    @Override
    protected int strategyName() {
        return MessageType.CHART.getType();
    }
}
